package com.jack.leetcode.每日一题;

import java.util.ArrayList;
import java.util.List;

public class 只出现一次的数字 {

    public static void main(String[] args) {
        int[] nums = {2,2,1};
        System.out.println(singleNumber(nums));
    }

    public static int singleNumber(int[] nums) {
        int result = nums[0];
        for(int i = 1;i<nums.length;i++){
            result ^= nums[i];
        }
        return result;
    }
}
